class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        p, i, mp = [0] * 200, 0, 0
        for j, k in enumerate(s):
            while p[ord(k)] > 0:
                p[ord(s[i])] -= 1
                i += 1
            p[ord(k)] += 1
            mp = max(mp, j - i + 1)
        return mp